home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / cuj1008.zip / ADAMO.LIS < prev    next >
File List  |  1992-04-08  |  840b  |  35 lines

  1.  
  2.  
  3. /*-----------------------------------------------------*
  4.  * curses_tst.c  -  C. Adamo  3/3/92
  5.  * Demonstrate single-character input mode using curses
  6.  *-----------------------------------------------------*/
  7. #include <stdio.h>
  8. #include <ctype.h>
  9. #include <curses.h>
  10.  
  11. #define QUIT_CHAR 'q'
  12.  
  13. void main(int argc, char *argv[])
  14.    {
  15.    int key = '\0';
  16.    
  17.    initscr();      /* initialize screen       */
  18.    cbreak();       /* enable single char mode */
  19.    noecho();       /* disable echo mode       */
  20.    
  21.    while (key != QUIT_CHAR)
  22.       {
  23.       key = getch();
  24.       if (isalpha(key))
  25.          {
  26.          printf("%c\n",
  27.                 islower(key) ? toupper(key)
  28.                              : tolower(key));
  29.          }
  30.       }
  31.    endwin();       /* end window modes        */
  32.    
  33.    } /* end main() */
  34.  
  35.